1. Field of the Invention
The present invention relates to the field of graphics controllers, and more particularly to graphics controllers having the capability of replicating pixels and of interpolating between pixels.
2. Prior Art
Certain prior art graphics controllers manufactured by Cirrus Logic, Inc., assignee of the present invention, have used a graphics data format referred to as AccuPak.RTM.. As may be seen in FIG. 1, in this format, pixel data is stored 4 pixels for every 32-bit word for display purposes as the 32-bit words are read out in sequence. Thus, data must be stored in the AccuPak.RTM. format for display purposes, even though this format does not directly lend itself to replicating pixels, and particularly to interpolating between pixels. Accordingly, when manipulating image data to stretch or shrink a video image in one or both directions, the video data in AccuPak.RTM. is first converted to YUV-444 format, the replication or interpolation required is then carried out on the YUV-444 data, and then the same is reconverted to the AccuPak.RTM. format.
As may be seen in FIG. 1, each 32-bit word of video data consists of four 5-bit components, such as Y.sub.0 through Y.sub.3, each representing in 5 bits the luminance value of the corresponding pixel of the respective four pixels 0 through 3. U.sub.0 and V.sub.0, on the other hand, are each 6-bit components of the 32-bit word and comprise the two chrominance components which will be used for all four pixel luminance values of the 32-bit word. Thus, in the AccuPak.RTM. format, luminance values are represented by a 5-bit component and can vary pixel to pixel, whereas the chrominance values are 6-bit components, and are fixed for each group of four pixels. The four pixels, of course, are four successive pixels in a raster scan image. The ability to use the same chrominance information for four successive pixels is due to the fact that the human eye is less sensitive to chrominance information, a fact utilized also in ordinary TV broadcasts, wherein the in-phase and quadrature chrominance signals on the chroma subcarrier have a substantially lower bandwidth than the luminance signal.
The conversion from AccuPak.RTM. to YUV, and more particularly YUV-444, is very simple, as illustrated in FIG. 2. In particular, for each of four pixel luminance values such as Y.sub.0 through Y.sub.3, the respective two values of chrominance U.sub.0 and V.sub.0 are directly associated, so that now each pixel is represented by a luminance value followed by its two chrominance values, even though the two chrominance values remain constant for four successive pixels. Also in this conversion, the 5 and 6-bit components are expressed in 8-bit byte form by padding the unoccupied bits with zeros.
In the prior art graphics controllers being described, circuitry was provided to reformat image data to stretch the image in either direction by a factor of 2, 4 or 8. This stretching, of course, is on a pixel to pixel basis. In a specific example, assume that an image is to be stretched 10% in the horizontal direction. Here, it is desired to convert the pixel data for ten successive pixels to pixel data for eleven successive pixels. This is done in the prior art graphics controller by interpolating between two adjacent pixels in the series of ten pixels, so that pixel data for an 11th pixel is provided. This provides a smoother transition than merely replicating one of the pixels, as replication, particularly as the stretching gets larger, gives the image a grainy appearance.
In the following table, Table 1, the manner in which such horizontal interpolation is carried out in the prior art may be seen.
TABLE 1 ______________________________________ 1-to-1 stretch 2-to-1 stretch 4-to-1 stretch 8-to-1 stretch ______________________________________ Y.sub.0, U.sub.0, Y.sub.0, U.sub.0, V.sub.0 Y.sub.0, U.sub.0, V.sub.0 Y.sub.0, U.sub.0, V.sub.0 V.sub.0 Y.sub.1, U.sub.0, V.sub.0 1 #STR1## 2 #STR2## Y.sub.0, U.sub.0, V.sub.0 Y.sub.2, U.sub.0, V.sub.0 Y.sub.1, U.sub.0, V.sub.0 1 #STR3## 2 #STR4## Y.sub.3, U.sub.0, V.sub.0 3 #STR5## 4 #STR6## 5 #STR7## Y.sub.4, U.sub.1, V.sub.1 Y.sub.2, U.sub.0, V.sub.0 Y.sub.1, U.sub.0, V.sub.0 1 #STR8## Y.sub.5, U.sub.1, V.sub.1 6 #STR9## 7 #STR10## 1 #STR11## . . . Y.sub.3, U.sub.0, V.sub.0 3 #STR12## 4 #STR13## 8 #STR14## 9 #STR15## 4 #STR16## Y.sub.4, U.sub.1, V.sub.1 Y.sub.2, U.sub.0, V.sub.0 Y.sub.1, U.sub.0, V.sub.0 0 #STR17## 1 #STR18## Y.sub.1, U.sub.0, V.sub.0 Y.sub.5, U.sub.1, V.sub.1 2 #STR19## 7 #STR20## . . . 3 #STR21## 7 #STR22## Y.sub.3, U.sub.0, V.sub.0 3 #STR23## 4 #STR24## 3 #STR25## 5 #STR26## 9 #STR27## 6 #STR28## 7 #STR29## Y.sub.4, U.sub.1, V.sub.1 Y.sub.2, U.sub.0, V.sub.0 8 #STR30## Y.sub.2, U.sub.0, V.sub.0 . . . 9 #STR31## 9 #STR32## ______________________________________
With no stretching (1-to-1), of course, the YUV-444 data is merely the YUV data for each successive pixel, as shown. For a 2-to-1 stretch, an interpolation is made so that data for an additional pixel is determined and effectively interposed between the data for adjacent pixels in the 1-to-1 version of the image data. This is done by taking the average of the luminance values of the two successive pixels (1/2Y.sub.0 +1/2Y.sub.1). In the example of the Figure, U.sub.0 and V.sub.0 are already applicable to both Y.sub.0 and Y.sub.1 and, accordingly represent "an average" for these two pixels already. Obviously, when interpolating between the fourth and fifth pixels, U.sub.0 and U.sub.1 could be averaged, as could V.sub.0 and V.sub.1, though this was not done because of the extra hardware required for minimal gain in visual appearance of the display.
For a 4-to-1 stretch, pixel data for three additional pixels are calculated and effectively interposed between each two pixels in the 1-to-1 image representation. These additional three pixels are also interpolations between two adjacent pixels in the 1-to-1 image data, calculated by a 3/4:1/4 weighting, a 1/2:1/2 weighting, and a 1/4:3/4 weighting, respectively in both the luminance and the two chrominance components. Again, U.sub.0 and V.sub.0 actually represent that weighting, as U.sub.0 and V.sub.0 are applicable to both pixel 0 and 1 in Table 1. As to interpolating between Y.sub.3 and Y.sub.4, the U and V values associated with one luminance value were used, not an interpolation between the two sets of values, as repacking the AccuPak.RTM. requires the same U and V values for four successive pixels. Finally, the 8-to-1 stretch is accomplished by merely replicating each pixel obtained from a 4-to-1 stretch.
The net effect of the foregoing is that circuitry for interpolating two adjacent values of Y, U and V by a 3/4:1/4, 1/2:1/2, and a 1/4:3/4 weighting already exists in the prior art products.
In the case of shrinking an image dimension, however, the problem is somewhat different. For instance, assume that an image dimension is to be shrunk to one-fourth of its original size. This may be readily done by merely picking each fourth pixel of the 1-to-1 image for display, such as is shown in Table 2.
TABLE 2 ______________________________________ 4-to-1 shrink ______________________________________ Y.sub.3,U.sub.0,V.sub.0 Y.sub.7,U.sub.1,V.sub.1 Y.sub.11,U.sub.2,V.sub.2 Y.sub.15,U.sub.3,V.sub.3 Y.sub.19,U.sub.4,V.sub.4 Y.sub.23,U.sub.5,V.sub.5 Y.sub.27,U.sub.6,V.sub.6 Y.sub.31,U.sub.7,V.sub.7 ______________________________________
Note, however, that in the 4-to-1 shrink, each successive pixel for display is taken from a different 32-bit image data word, and from its prior AccuPak.RTM. format, has its own unique value of U and V associated with it. Consequently, when converting from YUV-444 back to AccuPak.RTM., a value for U and V must be selected as representative for four successive pixels, such as Y.sub.3, Y.sub.7, Y.sub.11 and Y.sub.15 in the example shown. In the prior art devices, an arbitrary choice was made to always use one of the four sets of values for U and V to avoid the necessity of having to calculate anything different. Note, however, that such a choice in essence is associating a single set of values U.sub.n and V.sub.n to the equivalent of sixteen successive pixels of the original 1-to-1 image data. This has the effect of some image distortion and loss of image features that may have been brought out by the chrominance values there between.
Interpolation or shrinking in the vertical direction does not present the same problems, in that since each four successive (horizontal) pixels have the same values of U and V, interpolation of U and V in the vertical direction or skipping of entire lines will yield the same new values of U and V for each four successive horizontal pixels in the line or lines added by interpolation between two lines of the 1-to-1 image, or used in the shrunken image. In essence, an AccuPak.RTM. or AccuPak.RTM.-like formatting accommodates different values of U and V between all vertically adjacent pixels, but not horizontally adjacent pixels. In general, in the prior art, image size adjustment was done first in the vertical direction, then in the horizontal direction.